From: Xenia Ragiadakou Date: Mon, 22 Aug 2022 10:10:28 +0000 (+0200) Subject: xen/elf: fix MISRA C 2012 Rule 20.7 violations X-Git-Tag: archive/raspbian/4.17.0-1+rpi1^2~33^2~269 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c5659ef2dab3b4f538615e46a4990eea3101917c;p=xen.git xen/elf: fix MISRA C 2012 Rule 20.7 violations In macros ELF32_ST_TYPE() and ELF64_ST_TYPE(), add parentheses around the macro parameter to prevent against unintended expansions. Signed-off-by: Xenia Ragiadakou Reviewed-by: Stefano Stabellini --- diff --git a/xen/include/xen/elfstructs.h b/xen/include/xen/elfstructs.h index 616ebf9269..06e6f87c3d 100644 --- a/xen/include/xen/elfstructs.h +++ b/xen/include/xen/elfstructs.h @@ -305,11 +305,11 @@ typedef struct { /* Extract symbol info - st_info */ #define ELF32_ST_BIND(x) ((x) >> 4) -#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) +#define ELF32_ST_TYPE(x) (((unsigned int)(x)) & 0xf) #define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) #define ELF64_ST_BIND(x) ((x) >> 4) -#define ELF64_ST_TYPE(x) (((unsigned int) x) & 0xf) +#define ELF64_ST_TYPE(x) (((unsigned int)(x)) & 0xf) #define ELF64_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) /* Symbol Binding - ELF32_ST_BIND - st_info */